﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CPPEI.WebApi2
{
    public abstract class BaseModule
    {
        /// <summary>
        /// 初始化
        /// </summary>
        internal void Initiate()
        {
            try
            {
                OnInitiate();
                HasError = false;
            }
            catch(Exception ex)
            {
                HasError = true;
            }
            HasInitiated = true;
        }

        public bool HasInitiated { get; private set; }

        public bool? HasError { get; private set; }

        public string Name { get; internal set; }

        protected abstract void OnInitiate();

        public BaseModule()
        {
            HasInitiated = false;
        }
    }
}
